using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblDanhMucUI
{ 
	private int idDanhMuc;
	public int IdDanhMuc
	{
		get { return idDanhMuc;}
		set { idDanhMuc = value;}
	}

	private String tenDanhMuc;
	public String TenDanhMuc
	{
		get { return tenDanhMuc;}
		set { tenDanhMuc = value;}
	}

	private String ghiChu;
	public String GhiChu
	{
		get { return ghiChu;}
		set { ghiChu = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblDanhMucUI() {}

	public tblDanhMucUI(int idDanhMuc, String tenDanhMuc, String ghiChu, bool hoatDong)
	 {
		this.idDanhMuc = idDanhMuc;
 		this.tenDanhMuc = tenDanhMuc;
 		this.ghiChu = ghiChu;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenDanhMuc, String ghiChu, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDanhMuc_Add",tenDanhMuc,ghiChu,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idDanhMuc, String tenDanhMuc, String ghiChu, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDanhMuc_Update",idDanhMuc,tenDanhMuc,ghiChu,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idDanhMuc)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDanhMuc_Delete",idDanhMuc);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDanhMuc_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idDanhMuc)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDanhMuc_Get",idDanhMuc);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDanhMuc_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
